<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
{% load tags %}
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>{% block title %}{{ group.group_name }} Connect{% endblock %}</title>
{% block extra_css %}{% endblock %}
{% block extra_js %}{% endblock %}
    <link href="/static_media/StartGroup/css/group.css" media="screen, projection" rel="stylesheet" type="text/css"/>    
    
    <script src="/static_media/contifyuser/js/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
	$(document).ready(function(){$("a.delEvent").click(function(){
	    var eveid = $(this).attr('eveid');
            var webaddr = $("#hiddenWebaddr").html();
	    jQuery.ajax({
	      url: '/connectpeople/startGroup/' + webaddr +'/',
	      type: 'POST',
	      data: {'eveid':eveid},
	      dataType: 'json',
	      success: function(json){
                document.getElementById(eveid).style.display="none";
	    },
	      error: function(xhr, ajaxOptions, thrownError){
		alert("An Error Has Occurred. Please try again.");
	      }
	    });
	});
	});

    </script>
</head>

<body>
    <div id="hiddenWebaddr" style="display:none">{{ group.group_web_address }}</div>
    <div class="groupHeaderContainer">
        <div class="nobreak">            
            <div><a style="text-decoration: none;" href="/connectpeople/startGroup/{{ group.group_web_address }}"><span class="groupHeaderTitle"><strong>{{ group.group_name }}</strong></span></a></div>
            <div class="groupHeaderTagLine">{{ group.group_tagline }}</div>
        </div>
        
        <div id="container">
            <div class="nobreak">
                
            </div>            
            <div class="nobreak">
                <!--<li><a href="{% url contifyuser.views.viewprofile %}">Profile</a></li>-->
                <span class=""><a href="{% url StartGroup.views.startNewGroupForm %}">Start New Group</a></span>
                <a href="{% url discussions.views.discussionCommentForm %}">Start New Discussion</a>
                <a href="{% url discussions.views.discussionPortal %}">Discussions</a>
                <a href="{% url groupInfo.views.groupInfoFormView %}">Group Information</a>
                 <a href="{% url connectpeople.polls.views.index %}">Polls</a>
                {% if not isJoined %}
                    <a href="{% url groupMembers.views.joinGroup %}">Join</a>
                {% endif%}
            </div>
        </div>
    </div>
{% block content %}
    <div class="nobreak">
        <div class="eventsSection">
            <div>
                Upcoming Events
            </div>
            {% if up_group_event_list %}
                <ul type="none">
                {% for event in up_group_event_list %}
                        <!-- Redirect to group -->
                       <li>
                            <div id="{{ event.id }}">
                                <div>
                                    <a href="/connectpeople/groupevents/{{ event.id }}">{{ event.event_name }}</a>
                                    {{ event.event_date }}
                                    <a href="/connectpeople/groupevents/edit/{{ event.id }}" eveid="{{ event.id }}" class="editEvent"><img class="eventEditIcon" title="edit" src="/{{ media_url }}/StartGroup/images/edit-icon.png"/></a>
                                    <a href="#" eveid="{{ event.id }}" class="delEvent"><img class="eventTrashImg" title="delete" src="/{{ media_url }}/StartGroup/images/trash_icon.png"/></a>                                    
                                </div>
                                
                                <div>{{ event.event_place }}</div>
                                <div>{{ event.event_desc }}</div>
                            </div>    
                       </li>
                {% endfor %}
                </ul>
            {% else %}
                <div>No Upcoming Events</div>
            {% endif %}
            <a href="{% url groupevents.views.CreateNewEventForm %}">Create New Event</a>
        </div>
        <div class="eventsSection">
            <div>
                Previous Events
            </div>
            {% if prev_group_event_list %}
                <ul type="none">
                {% for event in prev_group_event_list %}
                        <!-- Redirect to group -->
                       <li>
                            <div id="{{ event.id }}">    <div>
                                    <a href="/connectpeople/groupevents/{{ event.id }}">{{ event.event_name }}</a>
                                    {{ event.event_date }}
                                    <a href="/connectpeople/groupevents/edit/{{ event.id }}" eveid="{{ event.id }}" class="editEvent"><img class="eventEditIcon" title="edit" src="/{{ media_url }}/StartGroup/images/edit-icon.png"/></a>
                                    <a href="#" eveid="{{ event.id }}" class="delEvent"><img class="eventTrashImg" title="delete" src="/{{ media_url }}/StartGroup/images/trash_icon.png"/></a>                                    
                                </div>
                                <div>{{ event.event_place }}</div>
                                <div>{{ event.event_desc }}</div>
                            </div>    
                       </li>
                {% endfor %}
                </ul>
            {% else %}
                <div>No Past Events</div>
            {% endif %}
        </div>       
    </div>
    <div class="nobreak">
        <div class="memberSection">
            {% if mem_list %}
                Members <a href="{% url groupMembers.views.member_view %}">see all members</a>
                <ul type="none">
                {% for mem in mem_list %}
                        <!-- Redirect to group -->
                       <li>
                            <div>
                                <div>
                                    {{ mem.photo|thumbnail }}
                                </div>
                                <div>{{ mem.first_name }} {{ mem.last_name }}</div>
                            </div>    
                       </li>
                {% endfor %}
                </ul>
            {% else %}
                <div>No Members</div>
            {% endif %}
        </div>
    </div>

    
{% endblock %}

{% block view_poll %}

{% endblock %}

{% block create_poll %}

{% endblock %}

{% block vote %}

{% endblock %}

</body>